// components/authorization/index.js
Component({
  /**
   * 组件的初始数据
   */
  data: {
    isLogin: false,
  },

  lifetimes: {
    attached() {
      const isLogin = !!getApp().token

      if (!isLogin) {
        wx.redirectTo({
          url: '/pages/login/index',
        })
      }
    },
  },
})
